from langchain_openai import ChatOpenAI

# 从环境变量中获取API密钥和模型名称
api_key = "34a3cc1f-3608-4c2e-8cbe-6f2076c30126"
model = "ep-20240606130022-nrz5h"

# 初始化ChatOpenAI对象
llm = ChatOpenAI(openai_api_key=api_key,
                 openai_api_base="https://ark.cn-beijing.volces.com/api/v3",
                 model=model,
                 temperature=0.8,
                 max_tokens=60)

# 以下几行可直接替换20-24行代码
response = llm.invoke([
    ("system", "你是一个智能机器人，可以回答人类许多问题。"),
    {
        "role":"human",
        "content":[
            {
                "type": "tool",
                "text": "请给我的花店起个名字。"
            },
            # {
            #     "type": "image_url",
            #     "image_url": "https://www.baidu.com/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.png"
            # }
        ]
    },

])

print(response.content)



